<template>
    <div>
        <went :title="title"></went>
        <div style="height: 45px;"></div>
        <van-tabs v-model:active="active">
            <van-tab title="商品">
                 <swiper :images="images"></swiper>
            </van-tab>
            <van-tab title="详情">
                <div v-html="detail.goods_introduce"></div>
                <van-action-bar>
                    <van-action-bar-icon icon="chat-o" text="客服" dot />
                    <van-action-bar-icon icon="cart-o" text="购物车" badge="5" />
                    <van-action-bar-icon icon="shop-o" text="店铺" badge="12" />
                    <van-action-bar-button type="warning" text="加入购物车" @click="bth" />
                    <van-action-bar-button type="danger" text="立即购买" />
                </van-action-bar>
            </van-tab>
            <van-tab title="评论">内容 3</van-tab>
        </van-tabs>

    </div>
</template>

<script setup>
import went from '@/components/went.vue';
const title = '详情'
import { ref } from 'vue';
import { detailApi } from '@/api/api'
import { useRoute } from 'vue-router';
let route = useRoute()
let detail = ref([])
detailApi(route.params.goods_id).then(res => {
    console.log('详情数据', res);
    detail.value = res.data.message;
})
import { useRouter } from 'vue-router';
let router = useRouter();
let bth = () => {
      
    router.push('/home/cart')
}
import swiper from '@/components/swiper.vue';
const images = [
    'https://fastly.jsdelivr.net/npm/@vant/assets/apple-5.jpeg',
    'https://fastly.jsdelivr.net/npm/@vant/assets/apple-6.jpeg',
    'https://fastly.jsdelivr.net/npm/@vant/assets/apple-7.jpeg',
    'https://fastly.jsdelivr.net/npm/@vant/assets/apple-8.jpeg',
];
</script>

<style lang="scss" scoped></style>